﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Streambolics.Tablet;

namespace TabletTest
{
    public partial class UserControl1 : TouchTrackerUserControl
    {
        public UserControl1 ()
        {
            InitializeComponent ();
            DoubleBuffered = true;
        }

        protected override void OnPaint (PaintEventArgs e)
        {
            base.OnPaint (e);
            Graphics gfx = e.Graphics;
            Pen myPen = new Pen (Color.Black);

            foreach (ITouchTracker t in ActiveTrackers)
            {
                if (t is CommonTouchTracker)
                {
                    CommonTouchTracker ctt = t as CommonTouchTracker;

                    gfx.DrawLine (myPen, 0, ctt.LastY, 1000, ctt.LastY);
                    gfx.DrawLine (myPen, ctt.LastX, 0, ctt.LastX, 1000);
                }
            }
        }

        protected override ITouchTracker CreateTouchTracker (WMTouchEventArgs e)
        {
            return new CommonTouchTracker ();
        }

        protected override void OnTrackerAdded (TouchTrackerEventArgs e)
        {
            base.OnTrackerAdded (e);
            Invalidate ();
        }

        protected override void OnTrackerChanged (TouchTrackerEventArgs e)
        {
            base.OnTrackerChanged (e);
            Invalidate ();
        }

        protected override void OnTrackerRemoved (TouchTrackerEventArgs e)
        {
            base.OnTrackerRemoved (e);
            Invalidate ();
        }
    }
}
